from nicegui import ui


def header():  # 添加导航栏
    with ui.column():
        ui.button('首页', on_click=lambda: ui.open(home_page)).classes("self-center")
        ui.button('功能一', on_click=lambda: ui.open(page1)).classes("self-center")
        ui.button('功能二', on_click=lambda: ui.open(page2)).classes("self-center")
        ui.button('功能三', on_click=lambda: ui.open(page3)).classes("self-center")
        ui.button('功能四', on_click=lambda: ui.open(page4)).classes("self-center")
        ui.button('功能五', on_click=lambda: ui.open(page5)).classes("self-center")


# 创建首页界面
@ui.page("/")
def home_page():
    ui.label('信息管理系统设置').classes('self-center')

    with ui.grid(columns=2).classes('w-[80%] self-center row'):
        with ui.column().classes("col-3 self-center"):
            header()

        with ui.column().classes("col-8 self-center"):
            ui.label('首页设置页面').classes('self-center')
            ui.input(label='设置文件名', placeholder='start typing', ).classes("self-center")
            ui.input(label='打印机设置', placeholder='start typing', ).classes("self-center")


# 创建功能一设置界面
@ui.page("/page1")
def page1():
    header()
    ui.label('功能一设置页面').classes('self-center')

'''
from nicegui import ui


def ui_main():
    ui.label('信息管理系统设置').classes('self-center')
    with ui.grid(columns=2).classes('w-[80%] self-center row'):
        with ui.tabs().classes('col-auto self-center').props('vertical') as tabs:
            func0 = ui.tab("首页")
            func1 = ui.tab('功能一')
            func2 = ui.tab('功能二')
            func3 = ui.tab('功能三')
            func4 = ui.tab('功能四')
        with ui.tab_panels(tabs, value=func0).classes('col self-center'):
            with ui.tab_panel(func0):
                ui.label('基础设置')
                with ui.column():
                    ui.input(label='设置文件名', placeholder='start typing', )
                    ui.input(label='打印机设置', placeholder='start typing', )
            with ui.tab_panel(func1):
                ui.label('功能一')
            with ui.tab_panel(func2):
                ui.label('功能二')
            with ui.tab_panel(func3):
                ui.label('功能三')
            with ui.tab_panel(func4):
                ui.label('功能四')


ui_main()
ui.run(reload=False, native=True)
'''

ui.run()